package com.study.chapter05.operator.source;

import com.study.entity.Event;
import com.study.chapter05.source.ClickSource;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @Description:
 * @Author: LiuQun
 * @Date: 2022/7/27 22:23
 */
public class SourceCustomTest {
    public static void main(String[] args) throws Exception {
        //环境
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        //使用自定义的SourceFunction，注意对于自定义的直接继承SourceFunction的，并行度只能设置为1，否则会抛出异常
        DataStreamSource<Event> stream = env.addSource(new ClickSource()).setParallelism(1);

        stream.print();

        env.execute();
    }
}
